package com.itheima.api;

import java.math.BigDecimal;
import java.math.RoundingMode;

/*
BigDecimal  除法运算
 */
public class Demo09 {

    public static void main(String[] args) {
        BigDecimal bd1 = new BigDecimal("20.0");
        BigDecimal bd2 = new BigDecimal("3.0");
       // System.out.println(bd1.divide(bd2)); 如果除不尽 直接报错了
        System.out.println(bd1.divide(bd2, 4, BigDecimal.ROUND_UP));
        System.out.println(bd1.divide(bd2, 4, BigDecimal.ROUND_DOWN));
        System.out.println(bd1.divide(bd2, 4, RoundingMode.HALF_UP));


    }
}
